﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SimplePMT.Data;

namespace SimplePMT
{
    public partial class Projects : Components.BasePage
    {
        public string ProjectTree = string.Empty;
        public string TaskJSArray = string.Empty;

        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(Ajax.Projects), this.Page);
            ValidateSession();
            ProjectTree = Ajax.Projects.GetProjectTreeNode(0, false);
            TaskJSArray += "var completeArray = new Array();\r\n";
            //TaskJSArray += "var myArray = new Array();\r\n";

            int MemberID = Convert.ToInt32(Session["MemberID"]);

            Task[] tasks = Task.FindAll();
            int i = 0;
            //int j = 0;
            foreach (Task task in tasks)
            {
                if (!task.ClosedDateTime.Equals(new DateTime(1900, 1, 1)))
                {
                    TaskJSArray += "completeArray[" + i + "] = 'taskRow" + task.ID + "';\r\n";
                    i++;
                }

                //if (task.AssignedMemberID.Equals(MemberID))
                //{
                //    TaskJSArray += "myArray[" + j + "] = 'taskRow" + task.ID + "';\r\n";
                //    j++;
                //}
            }
        }
    }
}
